<?php

class g5_admin_group extends Model {

	function __construct(){
			parent::__construct();
            $this->_tableName = 'g5_admin_group';
	}


    public function groupList($format = false){
        $return = array();
        $result = $this->getAll('*');
        if($format){
            foreach($result as $row){
                $return[$row['group_id']] = $row;
            }
            return $return;
        }
        return $result;
    }


    function getGroupList(){
        $return = array();
        $result = $this->getAll('*');
        foreach($result as $row){
            $return[$row['group_id']] = $row['group_value'];
        }
        return $return;
    }

    /**
     * 根据用户组获取其下属游戏权限
     * @param $groupId
     * @author Giles giles.wang@icloud.com
     * return string
     */
    function getGameBygroup($groupId)
    {
        return $this->getOne('group_game', array('group_id' => $groupId));
    }
}